package cn.leyaber.hrm.fallback;


import cn.leyaber.hrm.clients.UserFeignClient;
import cn.leyaber.hrm.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

//降级
@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignClient> {

    @Override
    public UserFeignClient create(Throwable throwable) {
        return new UserFeignClient(){
            @Override
            public AjaxResult getByLoginId(Long id) {
                throwable.printStackTrace();
                return AjaxResult.me().setSuccess(false).setMessage("权限获取失败");
            }
        };
    }
}
